{% import 'snippets/links.jinja' as links %}


{% macro medals(info) %}

<!-- MEDALS -->
{% for year in info.medals.gold -%}
<a title="Best Artist in {{ year }}" class="hidelink medal shiny hovershiny gold" href='/charts_artists?max=50&amp;in={{ year }}'>
	<span>{{ year }}</span>
</a>
{%- endfor %}
{% for year in info.medals.silver -%}
<a title="Second best Artist in {{ year }}" class="hidelink medal shiny hovershiny silver" href='/charts_artists?max=50&amp;in={{ year }}'>
	<span>{{ year }}</span>
</a>
{%- endfor %}
{% for year in info.medals.bronze -%}
<a title="Third best Artist in {{ year }}" class="hidelink medal shiny hovershiny bronze" href='/charts_artists?max=50&amp;in={{ year }}'>
	<span>{{ year }}</span>
</a>
{%- endfor %}

{% if info.medals.gold or info.medals.silver or info.medals.bronze %}
    <span class="spacer" ></span>
{% endif %}

{%- endmacro %}








{% macro topweeks(info) %}

{% set encodedartist = mlj_uri.uriencode({'artist':info.artist}) %}


<!-- TOPWEEKS -->
<span>
	{% if info.topweeks > 0 -%}
	<a title="{{ info.topweeks }} weeks on #1" href="/performance?{{ encodedartist }}&step=week">
		<img class="star" src="/media/star.png" />{{ info.topweeks }}</a>
	{%- endif %}
</span>

{% if info.topweeks > 0 %}
    <span class="spacer" ></span>
{% endif %}

{%- endmacro %}









{% macro subcerts(artist) %}

<!-- SUBCERTS -->


{% set albumcharts = dbc.get_charts_albums({'artist':artist,'timerange':malojatime.alltime(),'resolve_ids':True,'only_own_albums':True}) %}
{% for e in albumcharts -%}
	{%- if e.scrobbles >= settings.scrobbles_gold_album -%}{% set cert = 'gold' %}{%- endif -%}
	{%- if e.scrobbles >= settings.scrobbles_platinum_album -%}{% set cert = 'platinum' %}{%- endif -%}
	{%- if e.scrobbles >= settings.scrobbles_diamond_album -%}{% set cert = 'diamond' %}{%- endif -%}

	{%- if cert -%}
	<a href='{{ links.url(e.album) }}' class="hidelink certified certified_{{ cert }} smallcerticon" title="{{ e.album.albumtitle | e }} has reached {{ cert.capitalize() }} status">
    	    {% include 'icons/cert_album.jinja' %}
    	</a>
	{%- endif %}

{%- endfor %}


{% set charts = dbc.get_charts_tracks({'artist':artist,'timerange':malojatime.alltime()}) %}
{% for e in charts -%}
	{%- if e.scrobbles >= settings.scrobbles_gold -%}{% set cert = 'gold' %}{%- endif -%}
	{%- if e.scrobbles >= settings.scrobbles_platinum -%}{% set cert = 'platinum' %}{%- endif -%}
	{%- if e.scrobbles >= settings.scrobbles_diamond -%}{% set cert = 'diamond' %}{%- endif -%}

	{%- if cert -%}
	<a href='{{ links.url(e.track) }}' class="hidelink certified certified_{{ cert }} smallcerticon" title="{{ e.track.title | e }} has reached {{ cert.capitalize() }} status">
    	    {% include 'icons/cert_track.jinja' %}
    	</a>
	{%- endif %}

{%- endfor %}



{%- endmacro %}
